package com.doge.bean.base;

/**
 * @program: doge
 * @description: 成功的errno = 0
 * @author: Keyu Li
 * @create: 2021-11-29 14:21
 **/

import lombok.Data;

@Data
public class BaseRespVo {
    Integer errno;
    String errmsg;
    /*
    * 跟用 T 泛型效果是一样的
    * */
    Object data;

    public BaseRespVo(Integer errno, String errmsg, Object data) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.data = data;
    }

    public static BaseRespVo ok(){
        return new BaseRespVo(0,"成功",null);
    }

    public static BaseRespVo ok(Object data){
        return new BaseRespVo(0,"成功",data);
    }

    public static BaseRespVo error(Integer errno, String errmsg){
        return new BaseRespVo(errno,errmsg,null);
    }
}

